from django.db import models
from valar.models.core import VModel


class InputPanel(VModel):

    class Meta:
        verbose_name = '原料面板'


class InputMaterial(VModel):
    panel = models.ForeignKey(InputPanel, null=True, on_delete=models.CASCADE, verbose_name='面板')
    category = models.CharField(max_length=50, null=True, verbose_name='类型')
    value = models.FloatField(default=0, null=True, verbose_name='数值')

    class Meta:
        verbose_name = '原料'
        unique_together = ('panel','category')


class Result(VModel):
    panel = models.OneToOneField(InputPanel, null=True, on_delete=models.CASCADE, verbose_name='面板')
    value =  models.FloatField(default=0, null=True, verbose_name='计算结果')
    class Meta:
        verbose_name = '原料面板'
